Add AVX2 optimizations for ML-DSA NTT operations#3
Open
Conversation
7fd35f2 to
7d850a5
Compare
This commit introduces AVX2-vectorized assembly implementations of the Number Theoretic Transform (NTT) operations used in ML-DSA (FIPS 204). These optimizations improve performance of ML-DSA key generation, signing, and verification operations on x86_64 platforms with AVX2 support. The implementation adds the following functions: - ml_dsa_poly_ntt_avx2: Forward NTT transformation - ml_dsa_poly_ntt_inverse_avx2: Inverse NTT transformation - ml_dsa_poly_ntt_mult_avx2: NTT-domain polynomial multiplication Key implementation details: - Uses YMM registers to process 8 32-bit coefficients in parallel - Employs Montgomery reduction for modular arithmetic - Implements NTT butterfly operations across multiple transform levels - Includes dedicated zeta table for INTT to reduce cycles - Runtime capability check via ml_dsa_ntt_avx2_capable() using OPENSSL_ia32cap_P to detect AVX2 support The C code in ml_dsa_ntt.c is updated to dispatch to AVX2 implementations at runtime when available, with automatic fallback to the portable C implementation on platforms without AVX2 support. Build system changes: - Added GENERATE rule for ml_dsa_ntt-x86_64.s from Perl assembly - Conditional assembly inclusion based on target architecture - Works with both libcrypto and FIPS provider builds Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com> Signed-off-by: Tomasz Kantecki <tomasz.kantecki@intel.com>
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
Signed-off-by: Marcel Cornu <marcel.d.cornu@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist